// pages/goods/brand.js
var app = getApp();
var rootDocment = app.globalData.postUrl;
Page({

  /**
   * 页面的初始数据
   */
  data: {
    hiddenLoading: false,
    brandList: {},
    topNum: 0,
    hiddenTop: true
  },

  /**
   * 生命周期函数--监听页面加载
   */
  onLoad: function (options) {
    //初始化
    var that = this;
    wx.getSystemInfo({
      success: function (res) {
        that.setData({
          scrollHeight: res.windowHeight - 45
        });
      }
    });
    that.setBrandListData();
  },

  // 获取滚动条当前位置
  scrolltoupper: function (e) {
    if (e.detail.scrollTop > 100) {
      this.setData({
        hiddenTop: false
      });
    } else {
      this.setData({
        hiddenTop: true
      });
    }
  },

  //回到顶部
  goTop: function () {  // 一键回到顶部
    this.setData({
      topNum: 0
    });
  },

  //初始品牌列表
  setBrandListData: function () {
    var that = this;
    var paraArr = new Array();
    var sign = app.signature(paraArr);
    wx.request({
      url: rootDocment + '/api_brand',
      data: { sign: sign },
      method: 'GET',
      header: {},
      success: function (res) {
        that.setData({
          hiddenLoading: true,
          brandList: res.data
        });
      }
    })
  }

})